﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AllCauseTermEval.aspx.cs" Inherits="Credit_Teacher_Reprots_AllCauseTermEval" %>

<%@ Register Src="../../../Custom/SchoolYearClasses.ascx" TagName="SchoolYearClasses"
    TagPrefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>学分总评学期总评</title>
    <link href="../../Common/css/main.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../../Common/js/TableForExport.js"></script>
    <script type="text/javascript">
        var currentindex = null;
        var currentasc = false;
        function show(year,term,cls,id,cid){
            
        }
        function Load() {
           Select(); 
        }
    
        function Select() {
//            document.getElementById('<%=txtSchoolYear.ClientID %>').value = GetCurrentYear;
//            document.getElementById('<%=txtTerm.ClientID %>').value = GetCurrentTerm;
//            document.getElementById('<%=txtClsId.ClientID %>').value = GetCurrentClass;
            Bind();
        }
        
        function Bind() {
            document.getElementById('btnBind').click();
        }
    
        function getExcel() {
            var selClass = document.getElementById('selClass');
            var className = selClass.options[selClass.selectedIndex].text;
            var cells = GetTableInfo(document.getElementById('settingTable'));
            if(cells!=null) {
                PageMethods.GetExcel(className,cells,function(result){
                document.getElementById('downloadf').src = "";
                document.getElementById('downloadf').src = "../../../PostFileBytes.aspx";
                },function(err){alert(err._message);alert(err._message);});
            }
            
        }
        function getExcelEx(){
            var selClass = document.getElementById('selClass');
            var className = selClass.options[selClass.selectedIndex].text;
            var cells = GetTableInfo(document.getElementById('settingTableEx'));
            if(cells!=null) {
                PageMethods.GetExcel(className,cells,function(result){
                document.getElementById('downloadf').src = "";
                document.getElementById('downloadf').src = "../../../PostFileBytes.aspx";
                },function(err){alert(err._message);alert(err._message);});
            }
        }
    function sort(index) {
        //debugger;
        if(currentindex == null) {
            currentindex = 0;
            currentindex = 5*(parseInt( document.getElementById("settingTable").rows[0].cells.length)-8)+5;
            currentindex =currentindex-1;
        }
        if(currentindex == index)  {
            currentasc = !currentasc;
            var objs = document.getElementById("img"+index).getElementsByTagName('img');
            if(objs != null && objs.length > 0) {
                var obj = objs[0];
                if(!currentasc) {
                    obj.src = "../../Common/images/1.gif";
                }
                else {
                    obj.src = "../../Common/images/2.gif";
                }
            }
            SortTableCell(document.getElementById("settingTable"),currentindex,currentasc,2,0,0);
        }
        else {
            var str = document.getElementById("img"+currentindex).innerHTML;
            document.getElementById("img"+index).innerHTML=str;
            document.getElementById("img"+currentindex).innerHTML="";
            currentindex = index;
            SortTableCell(document.getElementById("settingTable"),currentindex,false,2,0,0);
        }
    }
    </script>
</head>
<body SCROLL="no" onload="Load();" id="bodyest" style="height: 85%; padding-top: 5px; padding-left: 5px; overflow-y: none; overflow-x: none;">
<form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
        </asp:ScriptManager>
            <div class="pageBody">
            <div class="mainWarp" >
                <table >
                <tr>
                    <td style="padding-left: 4px;">
                        学年学期：
                        <asp:DropDownList ID="selYear" runat="server" AutoPostBack="true" OnTextChanged="selYear_TextChanged">
                        </asp:DropDownList>
                    </td>
                    <td style="padding-left: 4px;">
                        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                            <ContentTemplate>
                                班级：<asp:DropDownList ID="selClass" runat="server" AutoPostBack="true" OnTextChanged="selClass_TextChanged">
                                </asp:DropDownList>
                            </ContentTemplate>
                            <Triggers>
                                <asp:AsyncPostBackTrigger ControlID="selYear" EventName="TextChanged" />
                            </Triggers>
                        </asp:UpdatePanel>
                    </td>
                    <td style="padding-left:10px;">
                       <input id="Button1" type="button" value="查询" class="commonBut" style="display:block;"   onclick="Select(); resizeTable();"/>
                    </td>
                    
                    <td style="padding-left:10px;">
                       <input id="Button2" type="button" value="导出完整版" class="commonBut"  style="display:block;" onclick="getExcel()" />
                    </td>
                    <td style="padding-left:10px;">
                       <input id="Button3" type="button" value="导出简洁版" class="commonBut"  style="display:block;" onclick="getExcelEx()" />
                    </td>
                    <td style="padding-left:10px;">
                       <%--<input id="chkMoral" type="button" onclick="getExcel()" />--%>
                        <asp:CheckBox ID="chkMoral" runat="server" OnCheckedChanged="chkMoralChecked" Checked="true"/>计算德育
                    </td>
                </tr>
                </table>

                <div style="overflow-y:auto;overflow-x:none;height:98%;">
                <div id="divTable" style="width:600px;  height:300px; margin:left; overflow: auto;position: relative;">
                  <asp:UpdatePanel ID="upClass" runat="server">
                        <ContentTemplate>
                             <asp:Repeater ID="repeater1" runat="server">
                                <HeaderTemplate>
                                    <%# InitTableHead()%>
                                </HeaderTemplate>
                               <ItemTemplate>
                                    <%# InitTableBody() %>
                                </ItemTemplate>
                                <FooterTemplate>
                                </table>  <%# InitTableHeadEx()%><%# InitTableBodyEx() %></table>
                                </FooterTemplate>
                             </asp:Repeater>
                            
                             
                       </ContentTemplate>
                       <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="btnBind" EventName="Click" />
                       </Triggers>
                   </asp:UpdatePanel>
                </div>   
                </div> 
                 <div style="display: none;">
                    <asp:Button ID="btnBind" runat="server" Text="btnBind" OnClick="btnBind_Click" />
                    <asp:TextBox ID="txtSchoolYear" runat="server" />
                    <asp:TextBox ID="txtTerm" runat="server" />
                    <asp:TextBox ID="txtClsId" runat="server" />
                 </div>
            </div>
        </div>
        
    </form>
    <div id="upInputPop" class="layoutWarp" style="display: none">
        <iframe src="" name="downloadf" id="downloadf" style="height: 80%;width: 95%;overflow-y:auto;overflow-x:none;" frameborder="0"   ></iframe>
    </div>
</body>
<script type="text/javascript">
    function resizeTable(){
        var h=0;
        var w=0;
        if(document.body.scrollHeight>document.getElementById("bodyest").clientHeight)
        {
            h = document.getElementById("bodyest").clientHeight;
        }
        else
        {
            h = document.body.scrollHeight;
        }
        if(document.body.scrollWidth>document.getElementById("bodyest").clientWidth)
        {
            w = document.getElementById("bodyest").clientWidth+20;
        }
        else
        {
            w = document.body.scrollWidth-30;
        }
        
        if(h>0 && w>0)
        {
            document.getElementById("divTable").style.height=h+"px";
            document.getElementById("divTable").style.width=w+"px";
        }
    }
    resizeTable();
</script>
</html>
